#! /usr/bin/python

import os
import platform

os.system('rm -rf lwjgl-2.8.5')
os.system('unzip lwjgl-2.8.5.zip')

makeScriptString = (
    "# /bin/sh\n"
    "rm -rf asteroid_src/*.class\n"
    "javac -Xlint:unchecked -cp slick.jar:asteroid_src/:lwjgl-2.8.5/jar/lwjgl_util.jar:lwjgl-2.8.5/jar/lwjgl.jar asteroid_src/Asteroids.java\n")

runScriptString = (
    "#! /bin/sh\n"
    "java -cp slick.jar:asteroid_src:lwjgl-2.8.5/jar/lwjgl.jar:lwjgl-2.8.5/jar/lwjgl_util.jar:sounds/ -Djava.library.path=lwjgl-2.8.5/native/%s Asteroids\n")

if platform.system() == 'Linux':
    runScriptString = runScriptString % 'linux'
elif platform.system() == 'Darwin':
    runScriptString = runScriptString % 'macosx'
else:
    print 'Get a real operating system'
    exit()

open('make.sh', 'w').write(makeScriptString)
open('run.sh', 'w').write(runScriptString)

os.system('chmod +x make.sh')
os.system('chmod +x run.sh')
